package com.etms.controller;

import com.etms.pojo.SysUser;
import com.etms.service.AdminService;
import com.etms.service.RukuService;
import com.etms.vo.PageParmas;
import com.etms.vo.Result;
import com.etms.vo.RukuParmas;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("admin")
public class AdminController {
    @Autowired
    AdminService adminService;

    @GetMapping("yesRe/{id}")
    public Result yesRe(@PathVariable("id")Integer id,HttpSession session){
        SysUser user = (SysUser) session.getAttribute("user");
        Integer uid = user.getId();
        return adminService.yeRe(id,uid);
    }
    @GetMapping("noRe/{id}")
    public Result noRe(@PathVariable("id")Integer id,HttpSession session){
        SysUser user = (SysUser) session.getAttribute("user");
        Integer uid = user.getId();
        return adminService.noRe(id,uid);
    }
    @GetMapping("yesTui/{id}")
    public Result yesTui(@PathVariable("id")Integer id,HttpSession session){
        SysUser user = (SysUser) session.getAttribute("user");
        Integer uid = user.getId();
        return adminService.yesTui(id,uid);
    }
    @GetMapping("noTui/{id}")
    public Result noTui(@PathVariable("id")Integer id,HttpSession session){
        SysUser user = (SysUser) session.getAttribute("user");
        Integer uid = user.getId();
        return adminService.noTui(id,uid);
    }

    @PostMapping("getList")
    public Result getList(@RequestBody PageParmas pageParmas){
        return adminService.getList(pageParmas);
    }

    @GetMapping("getTuiList")
    public Result getTuiList(){
        return adminService.getTuiList();
    }


}
